<?php
use app\common\model\Category;
?>
	{layout name="layout/layout" /} {:widget('Menu/index',['category_id'=>$category_id])}
	<div class="king-content-wrap">
		<div class="king-layout1-content" style="margin-top: 0;">
			<ol class="breadcrumb">
				<li>
					<span>内容管理</span>
				</li>
				<li>
					<span>
						<?php echo Category::get($category_id)['title']; ?>
					</span>
				</li>
			</ol>
			<div class="panel panel-default m20">
				<div class="panel-body">
					<form action="{:Url('Article/add')}" method="post" id="form" onsubmit="return mySubmit();">
						<div class="label_list top20">
							<label class="label_name">标题
								<span style="color: red;font-size: 13px;">（还可输入
									<span id="show1">10</span>个字）</span>
							</label>
							<input oninput="ee()" id="title" class="form-control" type="text" name="title" />
						</div>
						<div class="label_list top20">
							<label class="label_name">封面图
								<span style="color: red;font-size: 13px;">(图片大小:536x274)</span>
							</label>
							<div class="label_img ">
								{:widget('Upload/image')}
							</div>
						</div>
						<div class="label_list top20">
							<label class="label_name">简介
								<span style="color: red;font-size: 13px;">（还可输入
									<span id="show">40</span>个字）</span>
							</label>
							<input oninput="ss()" id="jianjie" class="form-control" type="text" name="description" />
						</div>
						<div class="label_list top20">
							<label class="label_name">链接</label>
							<input class="form-control" type="text" name="url" />
						</div>
						<div class="label_list top20">
							<label class="label_name">是否跳转</label>
							<div>
								<input type="radio" name="isskip" value="1" />是
								<input type="radio" name="isskip" value="0" />否

							</div>
						</div>
						<div class="label_list top20">
							<label class="label_name">内容</label>
							<textarea name="content" id="ueditor" class="word_editor"></textarea>
						</div>
						<hr />
						<div class="label_list top20">
							<label class="label_name">seo_title</label>
							<input class="form-control" type="text" name="seo_title" />
						</div>
						<div class="label_list top20">
							<label class="label_name">seo_keyword</label>
							<input class="form-control" type="text" name="seo_keyword" />
						</div>
						<div class="label_list top20">
							<label class="label_name">seo_description</label>
							<input class="form-control" type="text" name="seo_description" />
						</div>

						<div class="label_list top40">
							<input type="submit" class="bos_button btn btn-success" value="保存" />
						</div>
						<input type="hidden" name="category_id" value="{$category_id}" />
					</form>
				</div>
			</div>
		</div>
	</div>
	<script>

		function mySubmit(flag) {
			return flag;
		}
		$("#form").submit(function () {
			var tel = $('#jianjie').val();
			var title = $('#title').val();
			if (tel.title > 10) {
				alert('标题不要超过10个字');
				return false;
			}

			if (tel.length > 40) {
				alert('简介不要超过40个字');
				return false;
			}
		});
		window.onload = function release() {
			var text = document.getElementById('jianjie');

			if (text.value.length > 40) {
				alert('超过字数')
			}

		}
		function ss() {
			var text = document.getElementById('jianjie');
			var show = document.getElementById('show');


			if (show.innerHTML < 1) {
				var date = $('#jianjie').val();

				var value = date.substring(0, 40);

				$('#jianjie').val(value);
			}
			show.innerHTML = 40 - text.value.length;


		}
		function ee() {
			var text = document.getElementById('title');
			var show = document.getElementById('show1');


			if (show.innerHTML < 1) {
				var date = $('#title').val();

				var value = date.substring(0, 10);

				$('#title').val(value);
			}
			show.innerHTML = 10 - text.value.length;


		}



	</script>